Skip to content

Conversation

@Elvis339
Copy link
Contributor

@Elvis339 Elvis339 commented Nov 27, 2025

Why

Track C-Chain reexecution benchmark performance over time. Catch regressions before production.

Closes #1494

How

Firewood → triggers AvalancheGo benchmark → downloads results → publishes to GitHub Pages

Screenshot 2026-01-27 at 16 12 02

Changes

  • scripts/bench-cchain-reexecution.sh

    • Trigger AvalancheGo's C-Chain reexecution benchmark
    • Poll for workflow registration
    • Wait for completion and download artifacts
  • .github/workflows/track-performance.yml

    • Orchestrate benchmark trigger via the script
    • Publish results to GitHub Pages (main → bench/, branches → dev/bench/{branch}/)

Usage

# Auth
nix run ./ffi#gh -- auth login
export GH_TOKEN=$(nix run ./ffi#gh -- auth token)

# Predefined test
./scripts/bench-cchain-reexecution.sh trigger firewood-101-250k

# With specific Firewood version
FIREWOOD_REF=v0.0.18 ./scripts/bench-cchain-reexecution.sh trigger firewood-101-250k

# Custom block range
RUNNER=avalanche-avalanchego-runner-2ti \
FIREWOOD_REF=v0.0.18 \
CONFIG=firewood \
START_BLOCK=1 \
END_BLOCK=100 \
BLOCK_DIR_SRC=cchain-mainnet-blocks-200-ldb \
./scripts/bench-cchain-reexecution.sh trigger

# Other commands
./scripts/bench-cchain-reexecution.sh tests    # list available tests
./scripts/bench-cchain-reexecution.sh list     # list recent runs
./scripts/bench-cchain-reexecution.sh status <run_id>
  • Set FIREWOOD_REF=v0.0.18 explicitly. Without it, the workflow builds from HEAD, which currently fails due to changes in FFI layer

Related

AvalancheGo: ava-labs/avalanchego#4650
Local iteration PR: #1642
Followup: #1639

Implements workflow to trigger C-Chain reexecution benchmarks in AvalancheGo
and track Firewood performance over time. Supports task-based and custom
parameter modes. Results stored in GitHub Pages via github-action-benchmark.
@Elvis339 Elvis339 changed the title Es/enable firewood dev workflow ci: Track Firewood Performance via AvalancheGo Benchmarks Nov 27, 2025
@Elvis339 Elvis339 changed the title ci: Track Firewood Performance via AvalancheGo Benchmarks ci(perf): Track Firewood Performance via AvalancheGo Benchmarks Nov 27, 2025
@Elvis339 Elvis339 marked this pull request as ready for review November 27, 2025 15:04
@Elvis339
Copy link
Contributor Author

Elvis339 commented Nov 27, 2025

@Elvis339 Elvis339 marked this pull request as draft November 27, 2025 15:11
@Elvis339 Elvis339 self-assigned this Dec 1, 2025
@Elvis339 Elvis339 marked this pull request as ready for review December 2, 2025 20:32
@Elvis339 Elvis339 requested a review from alarso16 as a code owner December 4, 2025 17:17
# Structure on benchmark-data branch (see track-performance.yml for how this is populated):
# bench/ - Official benchmark history (main branch only)
# dev/bench/{branch}/ - Feature branch benchmarks (experimental)
- name: Include benchmark data
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build working: https://github.com/ava-labs/firewood/actions/runs/21334822723/job/61405063779
Deploy only works from main due to environment protection rules.

@Elvis339 Elvis339 requested a review from rkuris January 26, 2026 14:58
@Elvis339 Elvis339 marked this pull request as ready for review January 26, 2026 16:39
"**/tests/compile_*/**",
"justfile",
"scripts/run-just.sh",
"scripts/**",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added new benchmark script (bench-cchain-reexecution.sh) which
caused CI to fail with "Config does not cover the file". Shell
scripts aren't checked for license content (only .rs/.go/.h are),
but must be explicitly listed in the config. Exclude entire
scripts/ directory to avoid listing each script individually.

https://github.com/ava-labs/firewood/blob/main/.github/check-license-headers.yaml

Copy link
Member

@rkuris rkuris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early review, could use another pass

There's a lot of code here and I barely was able to complete the review in my maximum review time. Please consider breaking this up for more timely reviews, especially if the review is anything larger than this.

I'm also a little confused about how we track which firewood and avalanchego versions we ran the test against.

Let's say the performance loss was due to a change in avalanchego, how can we know that?

GH_TOKEN: ${{ secrets.FIREWOOD_AVALANCHEGO_GITHUB_TOKEN }}
# Custom mode (ignored when test is specified)
CONFIG: ${{ inputs.config }}
START_BLOCK: ${{ inputs.start-block }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like if you set START_BLOCK you better also be setting CURRENT_STATE_DIR_SRC to let it know where to get the bootstrap database, is that correct?

If so, we should verify that either neither is provided or both are.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CURRENT_STATE_DIR is optional, not required because you might want to start from Genesis.

# CURRENT_STATE_DIR_SRC (optional) S3 state directory (empty = genesis run)

Validation:

[[ -z "${START_BLOCK:-}${END_BLOCK:-}${BLOCK_DIR_SRC:-}" ]] && \

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to start from genesis, then you either must set START_BLOCK to 0 (1?) or not set it. So, if START_BLOCK is not 0, then CURRENT_STATE_DIR_SRC must be set. Isn't that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close, START_BLOCK should be 1 (not 0) for Genesis, and when CURRENT_STATE_DIR_SRC is empty it means starting from genesis (no pre-existing state to bootstrap from). So the valid combinations are:

  • Genesis run: START_BLOCK=1, CURRENT_STATE_DIR_SRC empty
  • Resume run: START_BLOCK=N, CURRENT_STATE_DIR_SRC points to state at block N-1

Remove local developer tooling (justfile recipe, flake.nix, METRICS.md)
to reduce PR scope. These will be submitted in a follow-up PR after
the CI workflow changes are merged.
@Elvis339
Copy link
Contributor Author

Elvis339 commented Jan 26, 2026

Early review, could use another pass

There's a lot of code here and I barely was able to complete the review in my maximum review time. Please consider breaking this up for more timely reviews, especially if the review is anything larger than this.

I'm also a little confused about how we track which firewood and avalanchego versions we ran the test against.

Let's say the performance loss was due to a change in avalanchego, how can we know that?

I've split into two PRs per your feedback:

  • This PR (CI): Workflows, benchmark script, license config
  • #1642 (Local tooling): justfile recipe, METRICS.md docs, flake.nix

On version tracking github-action-benchmark stores time-series data (mgas/s over time) without version metadata tracing a regression requires digging through run history.

This is a conscious tradeoff to get data flowing now with minimal setup, then iterate to something more robust (S3 storage, richer metadata, export for analysis). Planning to revisit after ~2 weeks of data collection.

For now, each run logs Firewood / Avalanchego refs in the GitHub Actions summary, so the info exists just not queryable. Added your concern to the tracking doc as something to think through for the next iteration. How does that sound?

Summary example: https://github.com/ava-labs/firewood/actions/runs/21334552166

@Elvis339 Elvis339 removed the DO NOT MERGE This PR is not meant to be merged in its current state label Jan 27, 2026
@Elvis339
Copy link
Contributor Author

Executing:

RUNNER=avalanche-avalanchego-runner-2ti \
FIREWOOD_REF=v0.0.18 \
CONFIG=firewood \
START_BLOCK=1 \
END_BLOCK=100 \
BLOCK_DIR_SRC=cchain-mainnet-blocks-200-ldb \
./scripts/bench-cchain-reexecution.sh trigger

Triggered reexecution benchmark in AvalancheGo https://github.com/ava-labs/avalanchego/actions/runs/21408080471

Comment on lines 79 to 87
err() {
if [[ "${GITHUB_ACTIONS:-}" == "true" ]]; then
echo "::error::$1"
else
echo "error: $1" >&2
fi
}

die() { err "$1"; exit 1; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we combine these two into one (i.e. just append the exit code to err and remove die)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping them separate as err logs without exiting (useful if we need to log multiple errors before bailing), die is the "fatal" version. Clearer intent at call sites.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only place we call err in bench_cchain_reexecution.sh is when we pass in an unknown command and even then, we exit afterwards with code 1.

Clearer intent at call sites.

I think replacing uses of die with err and exit 1 would be clearer in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Done

d5027de

GH_TOKEN: ${{ secrets.FIREWOOD_AVALANCHEGO_GITHUB_TOKEN }}
# Custom mode (ignored when test is specified)
CONFIG: ${{ inputs.config }}
START_BLOCK: ${{ inputs.start-block }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to start from genesis, then you either must set START_BLOCK to 0 (1?) or not set it. So, if START_BLOCK is not 0, then CURRENT_STATE_DIR_SRC must be set. Isn't that correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track Firewood Performance via AvalancheGo Reexecution Benchmarks

4 participants